(0) Obligation:

Runtime Complexity TRS:
The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Rewrite Strategy: FULL

(1) DecreasingLoopProof (EQUIVALENT transformation)

The following loop(s) give(s) rise to the lower bound Ω(2n):
The rewrite sequence
bubble(.(x, .(y, z))) →+ if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
gives rise to a decreasing loop by considering the right hand sides subterm at position [1,1].
The pumping substitution is [z / .(y, z)].
The result substitution is [ ].

The rewrite sequence
bubble(.(x, .(y, z))) →+ if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
gives rise to a decreasing loop by considering the right hand sides subterm at position [2,1].
The pumping substitution is [z / .(y, z)].
The result substitution is [x / y].

(2) BOUNDS(2^n, INF)

(3) RenamingProof (EQUIVALENT transformation)

Renamed function symbols to avoid clashes with predefined symbol.

(4) Obligation:

Runtime Complexity Relative TRS:
The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(<=(x, y), .(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

S is empty.
Rewrite Strategy: FULL

(5) SlicingProof (LOWER BOUND(ID) transformation)

Sliced the following arguments:
if/0
<=/0
<=/1

(6) Obligation:

Runtime Complexity Relative TRS:
The TRS R consists of the following rules:

bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(.(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

S is empty.
Rewrite Strategy: FULL

(7) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(8) Obligation:

TRS:
Rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(.(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
gen_nil:.:if:0'2_0 :: Nat → nil:.:if:0'

(9) OrderProof (LOWER BOUND(ID) transformation)

Heuristically decided to analyse the following defined symbols:
bsort, last, bubble, butlast

They will be analysed ascendingly in the following order:
last < bsort
bubble < bsort
butlast < bsort

(10) Obligation:

TRS:
Rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(.(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
gen_nil:.:if:0'2_0 :: Nat → nil:.:if:0'

Generator Equations:
gen_nil:.:if:0'2_0(0) ⇔ nil
gen_nil:.:if:0'2_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'2_0(x))

The following defined symbols remain to be analysed:
last, bsort, bubble, butlast

They will be analysed ascendingly in the following order:
last < bsort
bubble < bsort
butlast < bsort

(11) RewriteLemmaProof (LOWER BOUND(ID) transformation)

Proved the following rewrite lemma:
last(gen_nil:.:if:0'2_0(+(1, n4_0))) → gen_nil:.:if:0'2_0(0), rt ∈ Ω(1 + n40)

Induction Base:
last(gen_nil:.:if:0'2_0(+(1, 0))) →RΩ(1)
nil

Induction Step:
last(gen_nil:.:if:0'2_0(+(1, +(n4_0, 1)))) →RΩ(1)
last(.(nil, gen_nil:.:if:0'2_0(n4_0))) →IH
gen_nil:.:if:0'2_0(0)

We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).

(12) Complex Obligation (BEST)

(13) Obligation:

TRS:
Rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(.(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
gen_nil:.:if:0'2_0 :: Nat → nil:.:if:0'

Lemmas:
last(gen_nil:.:if:0'2_0(+(1, n4_0))) → gen_nil:.:if:0'2_0(0), rt ∈ Ω(1 + n40)

Generator Equations:
gen_nil:.:if:0'2_0(0) ⇔ nil
gen_nil:.:if:0'2_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'2_0(x))

The following defined symbols remain to be analysed:
bubble, bsort, butlast

They will be analysed ascendingly in the following order:
bubble < bsort
butlast < bsort

(14) RewriteLemmaProof (EQUIVALENT transformation)

Proved the following rewrite lemma:
bubble(gen_nil:.:if:0'2_0(+(2, n282_0))) → *3_0, rt ∈ Ω(2n)

Induction Base:
bubble(gen_nil:.:if:0'2_0(+(2, 0)))

Induction Step:
bubble(gen_nil:.:if:0'2_0(+(2, +(n282_0, 1)))) →RΩ(1)
if(.(nil, bubble(.(nil, gen_nil:.:if:0'2_0(+(1, n282_0))))), .(nil, bubble(.(nil, gen_nil:.:if:0'2_0(+(1, n282_0)))))) →IH
if(.(nil, *3_0), .(nil, bubble(.(nil, gen_nil:.:if:0'2_0(+(1, n282_0)))))) →IH
if(.(nil, *3_0), .(nil, *3_0))

We have rt ∈ Ω(2n) and sz ∈ O(n). Thus, we have ircR ∈ Ω(2n)

(15) BOUNDS(2^n, INF)

(16) Obligation:

TRS:
Rules:
bsort(nil) → nil
bsort(.(x, y)) → last(.(bubble(.(x, y)), bsort(butlast(bubble(.(x, y))))))
bubble(nil) → nil
bubble(.(x, nil)) → .(x, nil)
bubble(.(x, .(y, z))) → if(.(y, bubble(.(x, z))), .(x, bubble(.(y, z))))
last(nil) → 0'
last(.(x, nil)) → x
last(.(x, .(y, z))) → last(.(y, z))
butlast(nil) → nil
butlast(.(x, nil)) → nil
butlast(.(x, .(y, z))) → .(x, butlast(.(y, z)))

Types:
bsort :: nil:.:if:0' → nil:.:if:0'
nil :: nil:.:if:0'
. :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
last :: nil:.:if:0' → nil:.:if:0'
bubble :: nil:.:if:0' → nil:.:if:0'
butlast :: nil:.:if:0' → nil:.:if:0'
if :: nil:.:if:0' → nil:.:if:0' → nil:.:if:0'
0' :: nil:.:if:0'
hole_nil:.:if:0'1_0 :: nil:.:if:0'
gen_nil:.:if:0'2_0 :: Nat → nil:.:if:0'

Lemmas:
last(gen_nil:.:if:0'2_0(+(1, n4_0))) → gen_nil:.:if:0'2_0(0), rt ∈ Ω(1 + n40)

Generator Equations:
gen_nil:.:if:0'2_0(0) ⇔ nil
gen_nil:.:if:0'2_0(+(x, 1)) ⇔ .(nil, gen_nil:.:if:0'2_0(x))

No more defined symbols left to analyse.

(17) LowerBoundsProof (EQUIVALENT transformation)

The lowerbound Ω(n1) was proven with the following lemma:
last(gen_nil:.:if:0'2_0(+(1, n4_0))) → gen_nil:.:if:0'2_0(0), rt ∈ Ω(1 + n40)

(18) BOUNDS(n^1, INF)